package com.yuting;

import com.yuting.server.*;

import java.io.IOException;

/**
 * @author cyt
 * @date 2020/6/28
 */
public class test {
    public static void main(String[] args) {
        ServerInitClose serverInitClose = null;
        QuestionManagement qm = new QuestionManagement();
        StudentManagement sm = new StudentManagement();
        try {
            serverInitClose = new ServerInitClose();
            serverInitClose.serverInit();

            ServerView serverView = new ServerView(serverInitClose,new ServerDao(),sm,qm);
            serverView.serverReceive();
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }finally {
            //存储数据进内存
            qm.storeData();
            sm.storeData();
            try {
                if (serverInitClose != null) {
                    serverInitClose.serverClose();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
